-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/navigation component #100
Conversation
…avigation-component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay, this is cool.
app/components/Navigation.js
Outdated
constructor (props) { | ||
super(props) | ||
this.state = { | ||
drawerOpen: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm a fan of is*
boolean props, so isDrawerOpen
. helps disambiguate from thinking that this is a function which opens the drawer. what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A++ i agree
app/components/Navigation.js
Outdated
class Navigation extends React.Component { | ||
constructor (props) { | ||
super(props) | ||
this.state = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know i mentioned this before, but what do you think about using recompose
to handle stateful or lifecycle components? while i did say "functional purity" can be a trap, i am enjoying using recompose
so far.
so this would be:
import { connect as connectFela } from 'react-fela'
import { withState, withHandlers } from 'recompose'
import { pipe, not } from 'ramda'
import styles from '../styles/Navigation'
const Navigation = (props) => {
// render...
}
export default pipe(
connectFela(styles),
withState('isDrawerOpen', 'setDrawerOpen', false),
withHandlers({
toggleDrawer: ({ setDrawerOpen }) => () => setDrawerOpen(not)
})
)(Navigation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeaaaahhh nice ! i wanted to ask you how to do this actually - will give it a go!
app/components/Navigation.js
Outdated
} | ||
|
||
export default pipe( | ||
connectFela(styles) | ||
export default compose( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call on using recompose.compose
👍
app/components/Navigation.js
Outdated
drawerOpen: false | ||
} | ||
} | ||
function Navigation (props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful! 😺
closes #95